<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>学员管理</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic }/sdsng/js/join.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			//$("#name").focus();
			
			
			// add by zad 2018-01-30  校验用户名和手机号码是否存在（当用户名和手机号码都存在时，才认为重复）
			/* jQuery.validator.addMethod("mobile", function( value, element ) {
				alert(222);
				return true;
			}, "该用户已存在相同的手机号码，请确认。"); */
			
			
			
			$("#inputForm").validate({
				
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
		});
		
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/ems/emsStudent/">学员列表</a></li>
		<li class="active"><a href="${ctx}/ems/emsStudent/form?id=${emsStudent.id}&no=${emsStudent.no}">学员<shiro:hasPermission name="ems:emsStudent:edit">${not empty emsStudent.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="ems:emsStudent:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="emsStudent" action="${ctx}/ems/emsStudent/save" method="post" class="form-horizontal">
		<form:hidden id="id" path="id"/>
		<sys:message content="${message}"/>		
		<%-- <div class="control-group">
			<label class="control-label">报名人：</label>
			<div class="controls">
				<sys:treeselect id="user" name="user.id" value="${emsStudent.user.id}" labelName="user.name" labelValue="${emsStudent.user.name}"
					title="用户" url="/sys/office/treeData?type=3" cssClass="required" allowClear="true" notAllowSelectParent="true"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div> --%>
		<div class="control-group">
			<label class="control-label">学员编号：</label>
			<div class="controls">
				<form:input path="no" htmlEscape="false" readonly="true" maxlength="64" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
				<span class="help-inline"><font color="red">编号为自动生成，格式：日期+序号组成（yyyymm + 序号）</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">学员姓名：</label>
			<div class="controls">
				<form:input path="name" id="studentName" htmlEscape="false" maxlength="64" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">是否新生：</label>
			<div class="controls">
				<form:select path="isNew" class="input-xlarge required">
					<form:option value="1" label="是"/>
					<form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">性别：</label>
			<div class="controls">
				<%-- <form:input path="sex" htmlEscape="false" maxlength="2" class="input-xlarge "/> --%>
				<form:select path="sex" class="input-xlarge required">
					<form:option value="1" label="男"/>
					<form:option value="0" label="女"/>
				</form:select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">出生日期：</label>
			<div class="controls">
				<input name="birth" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					value="<fmt:formatDate value="${emsStudent.birth}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">手机号码：</label>
			<div class="controls">
				<form:input id="mobile" path="mobile" htmlEscape="false" onchange="doSubmit();" maxlength="16" class="input-xlarge required"/>
				<label id="tip" class='error' style="display: none;"></label>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">年级：</label>
			<div class="controls">
				<form:input path="grade" htmlEscape="false" maxlength="10" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">学校：</label>
			<div class="controls">
				<form:input path="school" htmlEscape="false" maxlength="64" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">地址：</label>
			<div class="controls">
				<form:input path="address" htmlEscape="false" maxlength="256" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">往期培训：</label>
			<div class="controls">
				<form:input path="pastTrain" htmlEscape="false" maxlength="256" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">是否启用：</label>
			<div class="controls">
				<form:select path="status" class="input-xlarge ">
					<form:option value="1" label="是"/>
					<form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="ems:emsStudent:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" onclick="return doSubmit();" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>